function addEventHandler(oNode, evt, oFunc, bCaptures) {
	if (typeof(window.event) != "undefined")
		oNode.attachEvent("on"+evt, oFunc);
	else
		oNode.addEventListener(evt, oFunc, bCaptures);
}
function removeEventHandler(oNode, evt, oFunc, bCaptures) {
    if (typeof (window.event) != "undefined")
        oNode.detachEvent("on" + evt, oFunc);
    else
        oNode.removeEventListener(evt, oFunc, bCaptures);
}
function getEventTarget(e) {
    if (window.event) return window.event.srcElement;
    else return e.target;
}

function onLinkClicked(e) {
    alert("You clicked the link!");
}
function onEnableClick(e) {
    var target = getEventTarget(e);
    if (target.checked)
        addEventHandler(document.getElementById("clickLink"), "click", onLinkClicked, false);
    else
        removeEventHandler(document.getElementById("clickLink"), "click", onLinkClicked, false);
}

function setUpClickEvent(e) {
    addEventHandler(document.getElementById("Checkbox1"), "click", onEnableClick, false);
}

addEventHandler(window, "load", setUpClickEvent, false);
